//
//  NetWorkRequest.h
//  URLSessionTest
//
//  Created by mac on 2017/7/7.
//  Copyright © 2017年 yyb. All rights reserved.
//

#import <Foundation/Foundation.h>
///  HTTP 请求方式
typedef NS_ENUM(NSInteger, RequestMethod) {
    RequestMethodGET = 0,
    RequestMethodPOST,
};

///  序列化方式
typedef NS_ENUM(NSInteger, RequestSerializerType) {
    RequestSerializerTypeHTTP = 0,
    RequestSerializerTypeJSON,
};

/// 响应序列化器类型，它确定响应序列化过程和“responseObject”的类型。
typedef NS_ENUM(NSInteger, ResponseSerializerType) {
    /// NSData type
    ResponseSerializerTypeHTTP,
    /// JSON object type
    ResponseSerializerTypeJSON,
    /// NSXMLParser type
    ResponseSerializerTypeXMLParser,
};
@class NetWorkRequest;

typedef void(^RequestCompletionBlock)(NetWorkRequest *request);

@interface NetWorkRequest : NSObject

@property (nonatomic, strong, readonly) NSData *responseData;
@property (nonatomic, strong, readonly) id responseJSONObject;
@property (nonatomic, strong, readonly) id responseObject;
@property (nonatomic, strong, readonly) NSString *responseString;
@property (nonatomic, strong, readonly) NSError *error;

- (void)startWithCompletionBlock:(RequestCompletionBlock)requestCompletionBlock;

@end
